<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <div id="app">

    </div>
    <script>
        let App = {
            template: `
            <div>
                <button @click= "toggleShow">show</button>
                <h2>{{fullName}}</h2>
                <h1>{{getFullName()}}</h1>
                <h2>{{msg}}</h2>

                <h2>{{reversedMessage}}</h2>
                <h2>{{price(2)}}</h2>
            </div>
            `,
            data() {
                return {
                    firstName: 'di',
                    lastName: 'dadi',
                    isShow: true,
                    msg: 'hello '
                }
            }, computed: {
                fullName() {
                    return this.firstName + this.lastName
                },
                reversedMessage: function () {
                    return this.msg.split('').reverse().join('')
                },
                price(ll) {
                    return function (ll) {
                        return 10 * ll
                    }
                }
            },
            methods: {
                getFullName() {
                    return this.firstName + this.lastName
                },
                toggleShow() {
                    console.log('成功');
                    this.isShow = !this.isShow
                }
            }
        }
        new Vue({
            render: h => h(App)
        }).$mount("#app")
    </script>
</body>

</html>